package com.example.wechat.csdnandroid.utils;


import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

/**
 * Created by liuan on 2017/5/16.
 */

public class ToolbarUtils {
    public  static  void setToolbar(int title, Toolbar mToolBar, final AppCompatActivity activity){
        mToolBar.setTitle(title);
        activity.setSupportActionBar(mToolBar);
        activity.getSupportActionBar().setHomeButtonEnabled(true);
        activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        mToolBar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                activity.onBackPressed();
            }
        });
    }

}
